
package com.yesep.learn.mqtt.client.handler.protocol;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.yesep.learn.mqtt.client.common.event.EventType;
import com.yesep.learn.mqtt.client.common.util.ChannelUtil;
import com.yesep.learn.mqtt.protocol.IUnSubAck;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.mqtt.MqttUnsubAckMessage;

/**
 * 消息编号：11
 * @Description: UNSUBACK连接处理，取消订阅应答
 */
public class UnSubAck {

	private static final Logger logger = LoggerFactory.getLogger(UnSubAck.class);

	public void process(ChannelHandlerContext ctx, MqttUnsubAckMessage message) {
		ChannelUtil.triggerUserEvent(ctx, EventType.UNSUBSCRIBE_SUCCESS, message);
		logger.info("unsubscribe success : {} ", ChannelUtil.clientId(ctx.channel()));
	}
}
